A defect inspection method is known which detects a linear defect, called a crack, from a shot image of the surface of an inspection object. FIG. 20 shows a flow chart of the conventional defect inspection method.
As shown in FIG. 20, the “likelihood of crack” is evaluated for all the pixels of a shot image as an input image according to a predetermined evaluation criterion, and highly evaluated pixels are extracted (step S101). Next, pixels having a high “likelihood of crack” are selected from the highly evaluated pixels using a predetermined threshold value (step S102). Of the selected pixels, those portions which are discontinuous but can be estimated to be actually continuous are subjected to connection processing to connect the pixels and regenerate the shape of a crack (step S103). Lastly, a group(s) of pixels, which is determined to be of a noise(s) based on threshold values set according to shape characteristics such as the size (width and length), the area (number of pixels), the ratio between the width and the length, etc., is removed from the selected pixels (step S104).
For example, an appropriate discrimination and choice can be made between a circular group of pixels and a linear group of pixels, both groups having the same area value, by making the determination based on the width/length ratio.
The above-described four steps are called an evaluation step, a selection step, a connection step and a correction step, as also described in FIG. 20.
The above-described conventional defect inspection method has the following problems: FIGS. 21(a) and 21(b) each show an image of an exemplary crack. In each image, a crack appears dark (black) on a bright (white) background. The crack C1 of FIG. 21(a) is a wide crack which is easy to detect.
On the other hand, the crack C2 of FIG. 21(b) is a narrow crack, which is difficult to discern from non-defective point-like or short linear patterns or irregularities existing in the background. Thus, the crack C2 is difficult to detect.
When the conventional method is used to detect a crack which is difficult to detect, such as the crack C2 shown in FIG. 21(b), there is a high possibility of the occurrence of false detection for the following reasons:
The conventional method has the following problems when a pixel luminance value is used as the “predetermined evaluation criterion” described in the step S101 of FIG. 20 and the “predetermined threshold value” described in the step S102 is used.
FIG. 22(a) illustrates a case in which because of a loose threshold value, a noise is falsely detected as a crack (non-defective object is falsely determined to be defective). FIG. 22(b) illustrates a case in which because of a strict threshold value, pixels of a crack are overlooked (defective object is falsely determined to be non-defective). FIG. 22(c) illustrates a case in which pixels having a luminance of not more than the threshold value 160, which is determined to be the optimal threshold value for the image to be inspected, are selected as pixels of a crack.
However, even in the case shown in FIG. 22(c), it is still possible that a noise may be falsely detected as a crack, or pixels of a crack may be overlooked. The crack inspection method, performed by using a luminance value in a simple manner, is thus largely affected by a noise, which makes it difficult to determine an optimal threshold value.
Further, the “threshold value 160” of FIG. 22(c) is subjectively determined to be the optimal threshold value for the image to be inspected for the first time after trying various luminance values as threshold values. Thus, the luminance value 160 is not always the optimal threshold value for other images to be inspected. It is, however, difficult in principle and in view of the processing time to determine an optimal threshold value for every image to be inspected. Therefore, it is common practice to determine a particular threshold value in advance, allowing for some degree of false detection of a noise and false determination of a non-defective object to be defective, and to perform a series of inspections of images based on the threshold value.
FIGS. 23(a) and 23(b) show a summary of the above-described problems of the conventional defect inspection method.
As shown in FIGS. 23(a) and 23(b), when an area with a luminance value of not less than a low threshold value Thl is selected as a selection area L, the area L consists of an area 2 where a portion of a crack and noises co-exist, and an area 3 which is substantially occupied by the crack. Therefore, pixels to be selected as crack-related pixels can be securely selected without being overlooked. On the other hand, many noises are also selected. Thus, while there are few crack-related pixels which are overlooked, the selection is of low “likelihood of crack”.
When an area with a luminance value of not less than a high threshold value Thh is selected as a selection area H, the area H consists solely of the area 3 which is substantially occupied by the crack. Accordingly, not a few pixels, which are to be selected as crack-related pixels, will be overlooked. Further, few noises will be selected. Thus, while there are a considerable number of crack-related pixels which are overlooked, the selection is of high “likelihood of crack”.
There is another problem which is due to no knowledge of a direction in which a crack is formed. In the present invention the accuracy of inspection of a crack increases as the scanning direction Ax comes near to a direction perpendicular to a direction in which the crack is formed, as shown in FIG. 24(a). On the other hand, the accuracy of inspection of a crack decreases as the scanning direction Ax comes near to a direction parallel to a direction in which the crack is formed, as shown in FIG. 24(b). The accuracy of inspection of a crack thus depends on the scanning direction. If a direction in which a crack is formed is known in advance, the inspection ability, in some cases, can be enhanced by making use of information on the direction of the crack as in the below-described connection processing.
However, a direction in which a crack is formed is actually rarely known in advance. If a direction in which a crack is formed is determined by visual observation before determining the scanning direction Ax, the inspection efficiency will be low. In addition, a fine crack(s) that has been overlooked in the visual observation will not be detected. The accuracy of detection will be high if a direction in which a crack is formed is determined by image processing of a shot image, and scanning is performed in a direction perpendicular to the determined direction. This method, however, may require a complicated image processing program and a long inspection time.
FIGS. 25(a) and 25(b) illustrate connection processing. In FIGS. 25(a) and 25(b), Cc1 to Cc3 and Cd1 to Cd3 denote pixel groups obtained as a result of evaluation processing and selection processing as performed in a conventional manner. The pixel groups Cc1 to Cc3, extending in a direction which is nearly parallel to the direction Cx of connection processing, are connected into a single linear shape by the connecting effect. The exact original shape of the crack is thus regenerated. On the other hand, the pixel groups Cd1 to Cd3, extending in a direction which is nearly perpendicular to the direction Cx of connection processing, are little subject to the connecting effect and remain discontinuous. Thus, the exact original shape of the crack cannot be regenerated.
Therefore, if a direction in which a crack is formed is not known in advance, the connection processing needs to be performed in all directions. However, such all-direction connection processing is undesirable because of the possibility of connecting the crack with surrounding noises. In particular, connection processing as performed in a direction perpendicular to a crack, as shown in FIG. 25(b), causes problems such as broadening of the width of the crack, a change in the shape of the crack due to coalescence of the crack and an adjacent noise(s), etc.
Thus, how to utilize information on the direction of a crack has been a significant problem in the prior art.